home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / exampleCode / games / IndiZone / gold / minnowClass.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-02  |  7.8 KB  |  249 lines

  1. /*
  2.  * The original copyright owners of the accompanying source code files have
  3.  * agreed to place such code into the public domain.  Accordingly, anyone
  4.  * who receives or obtains a copy of such source code is freely entitled to
  5.  * reproduce, use and otherwise exploit such code (including the right to
  6.  * make derivative works), at his/her own risk and expense, without any
  7.  * obligation or liability to the original copyright owners.
  8.  *
  9.  * We would appreciate (but do not require) that the following message be
  10.  * included in any derivative works:
  11.  *
  12.  * "Portions of this program were developed by Peter Broadwell, Rob Myers
  13.  * and Robin Schaufler while working in Silicon Valley."
  14.  *
  15.  * The accompanying source code files and related documentation materials
  16.  * are distributed on an "AS IS" basis, without any warranties or
  17.  * guarantees of any kind.  All implied warranties, including the implied
  18.  * warranties of merchantability and of fitness for any particular purpose,
  19.  * are expressly disclaimed.
  20.  */
  21. #include "gl.h"
  22. #include "geom.h"
  23. #include "selectors.h"
  24. #include "class.h"
  25. #include "classIds.h"
  26. #include "mbox.h"
  27. #include "individual.h"
  28. #include "behavior.h"
  29. #include "doers.h"
  30.  
  31. #include "colors.h"
  32.  
  33. extern class guppyClass;
  34. model minnowBody, minnowTail;
  35.  
  36.  
  37. fcnTable minnowTable[] = {
  38.     EOTABLE,
  39. };
  40.  
  41. class minnowClass = {
  42.     &guppyClass,
  43.     minnowTable,
  44.     sizeof(individual),
  45.     MINNOW,
  46. };
  47.  
  48. individual minnowTemplate = {
  49.             /*   inst        */
  50.     &minnowClass,    /* myClass pointer    */
  51.     NULL,        /* classFunctions     */
  52.     0,            /* nFunctions        */
  53.             /*   mailbox        */
  54.     NULL,        /* subscribers          */
  55.     NULL,        /* subscribedTo         */
  56.             /*   individual        */
  57.     {0,0,0},        /* position        */
  58.     {0,0,0},        /* lastPosition        */
  59.     {1,0,0},        /* delta        */
  60.     {1,1,1},        /* velocity        */
  61.     {1,1,1},        /* avelocity        */
  62.     {5,3,0},        /* acceleration        */
  63.     24.0,        /* speed        */
  64.     {40,30,10},        /* heading        */
  65.     {0,0,0},        /* rotation        */
  66.     {0,0,0},        /* influence        */
  67.     1.0,        /* scale                */
  68.     &minnowBody,    /* model        */
  69.     ORDER,        /* flags        */
  70.     NULL,        /* curVars        */
  71. };
  72.  
  73. point minnowBodyPoints[] = {
  74.     {    0,    0,    0, },    /* gratuitous vertex 0 */
  75.     {  000, -100,  000, },
  76.     {  200,  000, -300, },
  77.     {  750,  000, -030, },
  78.     {  300, -100,  300, },
  79.     {  300,  100,  300, },
  80.     {  000,  100,  000, },
  81.     {  730,  000, -130, },
  82.     {  710,  000, -100, },
  83. };
  84.  
  85. point minnowEyePoints[] = {
  86.     {    0,    0,    0, },    /* gratuitous vertex 0 */
  87.     {  -10,  000,    0, },
  88.     {   10,  000,   30, },
  89.     {   10,  000,   60, },
  90.     {  -10,  000,   80, },
  91.     {  -30,  000,  100, },
  92.     {  -70,  000,  100, },
  93.     {  -80,  000,   90, },
  94.     { -100,  000,   60, },
  95.     { -100,  000,   30, },
  96.     {  -90,  000,    0, },
  97.     {  -40,  000,  -10, },
  98. };
  99.         
  100. point minnowIrisPoints[] = {
  101.     {    0,    0,    0, },    /* gratuitous vertex 0 */
  102.     {   -8,  000,    0, },
  103.     {    8,  000,   24, },
  104.     {    8,  000,   48, },
  105.     {   -8,  000,   64, },
  106.     {  -32,  000,   72, },
  107.     {  -56,  000,   56, },
  108.     {  -64,  000,   32, },
  109.     {  -56,  000,    8, },
  110.     {  -32,  000,    0, },
  111. };
  112.  
  113. point minnowTailPoints[] = {
  114.     {    0,    0,    0, },    /* gratuitous vertex 0 */
  115.     {  000,  000,  000, },
  116.     { -300,  000,  400, },
  117.     { -300,  000, -550, },
  118. };
  119.  
  120.         /* null terminated polys, double null at end */
  121. long minnowBodyVertices[] = {
  122.     1,2,7,8,3,4,0,
  123.     6,5,3,8,7,2,0,
  124.     1,4,5,6,0,
  125.     1,6,2,0,
  126.     3,5,4,0,
  127.     0,
  128. };
  129. long minnowLEyeVertices[] = {
  130.     1,2,3,4,5,6,7,8,9,10,11,0,
  131.     0,
  132. };
  133. long minnowLIrisVertices[] = {
  134.     1,2,3,4,5,6,7,8,9,0,
  135.     0,
  136. };
  137. long minnowREyeVertices[] = {
  138.     11,10,9,8,7,6,5,4,3,2,1,0,
  139.     0,
  140. };
  141. long minnowRIrisVertices[] = {
  142.     9,8,7,6,5,4,3,2,1,0,
  143.     0,
  144. };
  145. long minnowTailVertices[] = {
  146.     1,2,3,0,
  147.     1,3,2,0,
  148.     0,
  149. };
  150.  
  151. model minnowTail = {
  152.     NULL,            /* next model segment          */
  153.     NULL,            /* child model segments        */
  154.     0,                /* geometry compiled yet?      */
  155.     0,                /* compiled geometry object Id */
  156.     minnowTailPoints,        /* point dictionary            */
  157.     minnowTailVertices,        /* polygon descriptions        */
  158.     { -150,0,-75},        /* centroid                    */
  159.     MINNOWTAIL_COLOR,        /* color                       */
  160.     MINNOWTAIL_TEXTURE,        /* texture                     */
  161.     TRUE,            /* outlined                    */
  162.     { 0,0,0},            /* rotation                    */
  163.     { 0,0,0},            /* translation                 */
  164.     { 1.0,1.0,1.0},        /* scale                       */
  165.     10,                /* declasse               */
  166. };
  167.  
  168. model minnowLIris = {
  169.     NULL,            /* next model segment          */
  170.     NULL,            /* child model segments        */
  171.     0,                /* geometry compiled yet?      */
  172.     0,                /* compiled geometry object Id */
  173.     minnowIrisPoints,        /* point dictionary            */
  174.     minnowLIrisVertices,    /* polygon descriptions        */
  175.     { -40,0,45},        /* centroid                    */
  176.     MINNOWIRIS_COLOR,        /* color                       */
  177.     MINNOWIRIS_TEXTURE,        /* texture                     */
  178.     FALSE,            /* outlined                    */
  179.     { 0,0,0},            /* rotation                    */
  180.     { -15,-10,0},        /* translation                 */
  181.     { 1.0,1.0,1.0},        /* scale                       */
  182.     25,                /* declasse               */
  183. };
  184. model minnowLEye = {
  185.     NULL,            /* next model segment          */
  186.     &minnowLIris,        /* child model segments        */
  187.     0,                /* geometry compiled yet?      */
  188.     0,                /* compiled geometry object Id */
  189.     minnowEyePoints,        /* point dictionary            */
  190.     minnowLEyeVertices,         /* polygon descriptions        */
  191.     { -45,0,45},        /* centroid                    */
  192.     MINNOWEYE_COLOR,        /* color                       */
  193.     MINNOWEYE_TEXTURE,        /* texture                     */
  194.     FALSE,            /* outlined                    */
  195.     { 0,0,0},            /* rotation                    */
  196.     { 600,-25,-50},        /* translation                 */
  197.     { 1.0,1.0,1.0},        /* scale                       */
  198.     30,                /* declasse               */
  199. };
  200. model minnowRIris = {
  201.     NULL,            /* next model segment          */
  202.     NULL,            /* child model segments        */
  203.     0,                /* geometry compiled yet?      */
  204.     0,                /* compiled geometry object Id */
  205.     minnowIrisPoints,        /* point dictionary            */
  206.     minnowRIrisVertices,    /* polygon descriptions        */
  207.     { -40,0,45},        /* centroid                    */
  208.     MINNOWIRIS_COLOR,        /* color                       */
  209.     MINNOWIRIS_TEXTURE,        /* texture                     */
  210.     FALSE,            /* outlined                    */
  211.     { 0,0,0},            /* rotation                    */
  212.     { -15,-10,0},        /* translation                 */
  213.     { 1.0,1.0,1.0},        /* scale                       */
  214.     25,                /* declasse               */
  215. };
  216. model minnowREye = {
  217.     &minnowLEye,        /* next model segment          */
  218.     &minnowRIris,        /* child model segments        */
  219.     0,                /* geometry compiled yet?      */
  220.     0,                /* compiled geometry object Id */
  221.     minnowEyePoints,        /* point dictionary            */
  222.     minnowREyeVertices,        /* polygon descriptions        */
  223.     { -45,0,45},        /* centroid                    */
  224.     MINNOWEYE_COLOR,        /* color                       */
  225.     MINNOWEYE_TEXTURE,        /* texture                     */
  226.     FALSE,            /* outlined                    */
  227.     { 0,0,0},            /* rotation                    */
  228.     { 600,25,-50},        /* translation                 */
  229.     { 1.0,1.0,1.0},        /* scale                       */
  230.     30,                /* declasse               */
  231. };
  232.  
  233. model minnowBody = {
  234.     &minnowTail,        /* next model segment          */
  235.     &minnowREye,        /* child model segments        */
  236.     0,                /* geometry compiled yet?      */
  237.     0,                /* compiled geometry object Id */
  238.     minnowBodyPoints,        /* point dictionary            */
  239.     minnowBodyVertices,     /* polygon descriptions        */
  240.     { -375,0,0},        /* centroid                    */
  241.     MINNOWBODY_COLOR,        /* color                       */
  242.     MINNOWBODY_TEXTURE,        /* texture                     */
  243.     TRUE,            /* outlined                    */
  244.     { 0,0,0},            /* rotation                    */
  245.     { 0,0,0},            /* translation                 */
  246.     { 1.0,1.0,1.0},        /* scale                       */
  247.     10,                /* declasse               */
  248. };
  249.